package com.example.service.impl;

import com.example.mapper.StaffMapper;
import com.example.pojo.Book;
import com.example.pojo.Staff;
import com.example.service.StaffService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Service;

/**
 * 名称StaffServiceImpl
 * 描述ServiceImpl
 *
 * @version 1.0
 * @author:wanghao
 * @datatime:2023,04,16,17,03
 */
@Service
@Primary
public class StaffServiceImpl implements StaffService {
    @Autowired
    StaffMapper staffMapper;

    @Override
    public String CheckStaffPasswd(String name,String passwd)
    {
        Staff staff = staffMapper.CheckStaffLogin(name);
        if (staff!=null)
        {
            if (staff.getPasswd().equals(passwd))   return "true";
            else return "wrong passwd";
        }
        else return "not exist";
    }

    @Override
    public int InsertBook(Book book)
    {
        return staffMapper.InsertBook(book);
    }

    @Override
    public int InsertStaff(Staff staff){return staffMapper.InsertStaff(staff);}

}
